Version

Protect(String,Nullable<Boolean>,Nullable<Boolean>) Method

Protects the Chartsheet with the specified password.
Syntax
'Declaration
 
Public Overloads Sub Protect( _
   ByVal password As String, _
   Optional ByVal allowEditObjects As Nullable(Of Boolean), _
   Optional ByVal allowEditContents As Nullable(Of Boolean) _
) 
public void Protect( 
   string password,
   Nullable<bool> allowEditObjects,
   Nullable<bool> allowEditContents
)

Parameters

password
The password used to protect the Worksheet.
allowEditObjects
Optional boolean indicating the new value for the Infragistics.Documents.Excel.Charts.ChartsheetProtection.AllowEditObjects.
allowEditContents
Optional boolean indicating the new value for the Infragistics.Documents.Excel.Charts.ChartsheetProtection.AllowEditContents.
Remarks

When a Chartsheet is protected without a password, the end user may unprotect the Chartsheet in Excel without having to supply a password. To programatically unprotect a Chartsheet, one may use the Sheet.Unprotect method.

The optional parameters are used to update the property values of the Infragistics.Documents.Excel.Charts.ChartsheetProtection instance from this Chartsheet's Protection property. If the parameter is null, the current value of the associated property will be retained; otherwise the property will be updated with the specified value. For example, if the Infragistics.Documents.Excel.Charts.ChartsheetProtection.AllowEditObjects is currently true and the allowEditObjects is null, then the property will continue to be true but if the allowEditObjects is false the Infragistics.Documents.Excel.Charts.ChartsheetProtection.AllowEditObjects will be changed to false.

Note: If Sheet.IsProtected is already true, the method will be ignored.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also